﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RandomColor : MonoBehaviour
{
    public Color color;
    // Start is called before the first frame update
    void Awake()
    {
        OnValidate();
    }

    void OnValidate()
    {

        color = Random.ColorHSV();
        var pb = new MaterialPropertyBlock();
        pb.SetColor("_Color", color);
        GetComponent<MeshRenderer>().SetPropertyBlock(pb);
    }

}
